<?php /*a:2:{s:69:"/www/wwwroot/jj.xueao400.com/application/jujin/view/article/form.html";i:1539334553;s:71:"/www/wwwroot/jj.xueao400.com/application/admin/view/public/content.html";i:1531908558;}*/ ?>
<!-- 右则内容区域 开始 -->

<div class="layui-card">
    <!--<?php if(!(empty($title) || (($title instanceof \think\Collection || $title instanceof \think\Paginator ) && $title->isEmpty()))): ?>-->
    <div class="layui-header notselect">
        <div class="pull-left"><span><?php echo htmlentities($title); ?></span></div>
        <div class="pull-right margin-right-15 nowrap"></div>
    </div>
    <!--<?php endif; ?>-->
    <div class="layui-card-body">
<form autocomplete="off" onsubmit="return false;" action="<?php echo request()->url(); ?>" data-auto="true" method="post" class='form-horizontal layui-form padding-top-20'>

    <div class="form-group">
        <label class="col-sm-2 control-label">文章名称</label>
        <div class='col-sm-8'>
            <input autofocus name="title" value='<?php echo htmlentities((isset($vo['title']) && ($vo['title'] !== '')?$vo['title']:"")); ?>' required="required" title="请输入文章名称" placeholder="请输入文章名称" class="layui-input">
        </div>
    </div>

    <!--<?php if(!empty($cates)): ?>-->
    <div class="form-group">
        <label class="col-sm-2 control-label">文章分类</label>
        <div class='col-sm-8'>
            <select required class="layui-select full-width" name="type" lay-filter="type">
                <?php foreach($cates as $cate): ?>
                <!--<?php if($cate['id'] == (isset($vo['type']) && ($vo['type'] !== '')?$vo['type']:0)): ?>-->
                <option selected="selected" value="<?php echo htmlentities($cate['id']); ?>"><?php echo htmlentities($cate['title']); ?></option>
                <!--<?php else: ?>-->
                <option value="<?php echo htmlentities($cate['id']); ?>"><?php echo htmlentities($cate['title']); ?></option>
                <!--<?php endif; ?>-->
                <?php endforeach; ?>
            </select>
        </div>
    </div>
    <!--<?php endif; ?>-->

    <div class="form-group childs_box">
        <label class="col-sm-2 control-label">扩展分类</label>
        <div class='col-sm-4'>
            <select required class="layui-select full-width childs_one" name="childs[]" lay-filter="childs_one"></select>
        </div>
        <div class='col-sm-4'>
            <select required class="layui-select full-width childs_two" name="childs[]" lay-filter="childs_two"></select>
        </div>
    </div>

    <!--<div class="form-group">
        <label class="col-sm-2 control-label label-required">图片</label>
        <div class='col-sm-8'>
            <table class="layui-table background-item margin-none" lay-size="sm" lay-skin="nob">
                <thead>
                <tr>
                    <td>文章图片</td>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td class="text-top" style="width:100px">
                        <input type="hidden" name="image" value="<?php echo htmlentities((isset($vo['image']) && ($vo['image'] !== '')?$vo['image']:'')); ?>">
                        <script>$('[name=image]').uploadOneImage()</script>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>-->

    <div class="form-group">
        <label class="col-sm-2 control-label">排序</label>
        <div class='col-sm-8'>
            <input name="sort" value='<?php echo htmlentities((isset($vo['sort']) && ($vo['sort'] !== '')?$vo['sort']:"0")); ?>'  title="请输入排序值" placeholder="请输入排序值" class="layui-input">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label label-required">文章内容</label>
        <div class='col-sm-8'>
            <textarea name="content"><?php echo htmlentities(htmlspecialchars_decode((isset($vo['content']) && ($vo['content'] !== '')?$vo['content']:''))); ?></textarea>
        </div>
    </div>

    <div class="hr-line-dashed"></div>

    <div class="col-sm-7 col-sm-offset-2">
        <div class="layui-form-item text-center">
            <?php if(!empty($vo['id'])): ?><input type="hidden" name="id" value="<?php echo htmlentities($vo['id']); ?>"><?php endif; ?>
            <button class="layui-btn" type="submit">保存</button>
            <button class="layui-btn layui-btn-danger" type='button' onclick="window.history.back()">取消</button>
        </div>
    </div>

    <script>
        require(['jquery', 'ckeditor', 'angular'], function () {
            window.form.render();
            window.createEditor('[name="content"]', {height: 500});
        });
        $(function(){
            page_init();
            //文章分类变更事件
            form.on('select(type)', function(data){
                var pid=0;
                if(data.value==19){
                    pid=32;
                }else if(data.value==22){
                    pid=33;
                }
                if(pid>0){
                    $('.childs_box').show();
                    //企业招聘
                    //查询工人邦分类
                    $.get('/api/other.system/my_cate_list',{pid:pid},function(data){
                        if(data.msg=='success'){
                            var obj=data.data;
                            $('.childs_one').html('<option value="">请选择</option>');
                            $('.childs_two').html('');
                            for(var i=0;i<obj.length;i++){
                                $('.childs_one').append('<option value="'+obj[i].id+'">'+obj[i].title+'</option>');
                            }
                            form.render('select');
                        }
                    });
                }else{
                    $('.childs_box').hide();
                    $('.childs_box select').html('');
                    form.render('select');
                }
            });
            //二级分类变更事件
            form.on('select(childs_one)', function(data){
                if(data.value>0){
                    $.get('/api/other.system/my_cate_list',{pid:data.value},function(data){
                        if(data.msg=='success'){
                            var obj=data.data;
                            $('.childs_two').html('');
                            for(var i=0;i<obj.length;i++){
                                $('.childs_two').append('<option value="'+obj[i].id+'">'+obj[i].title+'</option>');
                            }
                            form.render('select');
                        }
                    });
                }else{
                    $('.childs_two').html('');
                    form.render('select');
                }
            });

        });

        /**
         * 页面编辑初始化
         */
        function page_init(){
            var type=<?php echo htmlentities((isset($vo['type']) && ($vo['type'] !== '')?$vo['type']:'0')); ?>;
            var childs_0=<?php echo htmlentities((isset($vo['childs'][0]) && ($vo['childs'][0] !== '')?$vo['childs'][0]:0)); ?>;
            var childs_1=<?php echo htmlentities((isset($vo['childs'][1]) && ($vo['childs'][1] !== '')?$vo['childs'][1]:0)); ?>;
            var pid=0;
            if(type==19){
                pid=32;
            }else if(type==22){
                pid=33;
            }
            if(pid>0){
                $('.childs_box').show();
                $.get('/api/other.system/my_cate_list',{pid:pid},function(data){
                    if(data.msg=='success'){
                        var obj=data.data;
                        $('.childs_one').html('<option value="">请选择</option>');
                        $('.childs_two').html('');
                        for(var i=0;i<obj.length;i++){
                            $('.childs_one').append('<option '+(obj[i].id==childs_0?'selected':'')+' value="'+obj[i].id+'">'+obj[i].title+'</option>');
                        }
                        $.get('/api/other.system/my_cate_list',{pid:childs_0},function(data){
                            if(data.msg=='success'){
                                var obj=data.data;
                                $('.childs_two').html('');
                                for(var i=0;i<obj.length;i++){
                                    $('.childs_two').append('<option '+(obj[i].id==childs_1?'selected':'')+' value="'+obj[i].id+'">'+obj[i].title+'</option>');
                                }
                                form.render('select');
                            }
                        });
                    }
                });
            }
        }
    </script>

    <style>
        .childs_box{display: none;}
        .background-item {
            padding: 15px;
            background: #efefef;
        }

        .background-item thead tr {
            background: #e0e0e0
        }
    </style>
</form>
</div>
</div>

<!-- 右则内容区域 结束 -->